package cn.enilu.flash.api.service;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.profile.DefaultProfile;


//SMS_259810434  商家通知   接到新订单${item}，地址${address}，请查看。
public class SendMessage {
    
    public void send(String phone,String template,String params){
        DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI5tFRYED1r6RV7RPmCGsT", "YF913UHvAT1TF4tsu8EZubAsaQ3AL3");
        IAcsClient client = new DefaultAcsClient(profile);

        SendSmsRequest request = new SendSmsRequest();
        request.setPhoneNumbers(phone);//接收短信的手机号码
        request.setSignName("雷小雷");//短信签名名称
        request.setTemplateCode(template);//短信模板CODE   "SMS_259435632"
        request.setTemplateParam(params);//短信模板变量对应的实际值
        try {
            SendSmsResponse response = client.getAcsResponse(request);
            // System.out.println(new Gson().toJson(response));
        }catch(Exception e){

        }

    }
}
